/**
* @class
* An observer of ksg.App.bizProcMgr rule call sets, so that whenever a bizproc is executing
* bizrules, this class will turn on an ksg-acive class to the DOM element it is attached to.
* @meta-type jQuery widget
* @Depends ksg.baseWidget.js
*/
ksg.ui.widgets.SimpleSpinner = {
	options: {
	},
	_create: function() {
		var self = this, $this = self.element, options = self.options;
		
		ksg.App.bizProcMgr.addRulCallSetObserver({
			started: function() {
				$this.addClass("ksg-active");
				clearTimeout($this.timer);
			},
			completed: function() {
				$this.timer = setTimeout(function() {$this.removeClass("ksg-active");}, 100);
			}
		});
	}
};

$.widget("ksg.simpleSpinner", ksg.ui.widgets.SimpleSpinner);

ksg.ui.widgetMap["ksg-simpleSpinner"] = function ($el, options) {
	$el.simpleSpinner(options); 
};
